<?php
	require_once("../conexion/conexion.php");

  	$con = new Conexion();
    $con2 = $con->conexionBD("fpproduccion");
	$sql = "select CajMontoAct from caja where CajEstado='ACTIVO'";
    $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
	$montoAct = mysql_fetch_array($resultado);
	$con->cerrarBD();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario</title>
<link href="../Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />
<link href="../Estilos/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

<script src="../include_js/jquery.js" type="text/javascript"></script>


<style>
.texto
{
	font-size:14px;
	margin-left:10px;
	font:Verdana; 
	color:#0066CC;
}
.textoNumero
{
	font-size:14px;
	margin-left:10px;
	font:Verdana; 
	color:#000000;
}
.borde
{
	/*border:0px solid #6593C0;*/
	border:1px solid #D3E4E5;
}
.asterisco
{
	color:#0000FF;
	font-weight:bold;
}
.radioBorde
{ 
 background:#D3E4E5;
 border:0px solid #89C0C7;
}
</style>
<script>
function BorraDatosIngreso(dato)
{
	var cadena = dato.substring(8,9);
    if(cadena=='1')
	{
		document.form_MenuIngresoCaja.submit();
	}
	else
	{	document.getElementById("txtNuevoMontoCaja").focus();}
}

function GuardaNuevoMonto()
{
	$.ajax({
            type: 'POST',
            url: 'Contabilidad/Ingresa_MontoCajaChica.php',
            data: $('#form_MenuIngresoCaja').serialize(),
            success: function(data) {
                $('#mensajeIngreso').html(data);
				BorraDatosIngreso(data);
            }
        })
}

function foco()
{
	document.getElementById('txtNuevoMontoCaja').focus();
}
</script>
</head>
<body>
<form name="form_MenuIngresoCaja" id="form_MenuIngresoCaja" method="post">
<div class='groupbox'>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="uno">
<tr>
	 <td class="borde" colspan="2"><div style="float:left; clear:none; margin-left:10px; margin-top:5px;"><label style="color:#0000FF; font-size:12px; font-weight:bold;">Datos Obligatorios(*)</label></div></td>
	<td width="19%" class="borde">&nbsp;</td>
</tr>
<tr><td class="borde" colspan="3"><hr /></td></tr>
<tr>
  <td width="40%" class="borde">&nbsp;</td>
  <td width="41%" class="borde" style="text-align:right;"><label class="texto">Monto Actual:</label></td>
  <td class="borde"><label class="textoNumero"><?php echo "$".number_format ($montoAct[0],0,',','.');?></label></td>
</tr>
<td class="borde" style="text-align:right;"><label class="texto" >Monto ($):</label></td>
  <td class="borde"><input type="text" name="txtNuevoMontoCaja" id="txtNuevoMontoCaja" onkeyup="puntitos(this,this.value.charAt(this.value.length-1))"/>&nbsp;<label class="asterisco">*</label></td>
  <td class="borde">&nbsp;</td>
<tr>
  <td class="borde">&nbsp;</td>
  <td class="borde">&nbsp;</td>
  <td class="borde">&nbsp;</td>
</tr>
<tr>
  <td class="borde" colspan="3"><div class="formtail"><input name="btn_Guarda_Ingreso" id="btn_Guarda_Ingreso" type="button" value=" " class="guardar" onclick="GuardaNuevoMonto();" /></div></td>
</tr>
</table>
</div>
<?php
	echo "<script>foco();</script>";
?>
</form>
<div id="mensajeIngreso"></div>
</body>
</html>